package com.erp.myAdapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import androidx.viewpager.widget.PagerAdapter;

import java.util.List;

/**
 * Created by Administrator on 2017/4/2/002.
 * 作者：刘洋
 */

public class PageivAdapter extends PagerAdapter {
    //数据适配器
    private List<View> pageview;
    private Context context;
    public PageivAdapter(Context context, List<View> pageview) {
        this.pageview=pageview;
        this.context=context;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        View layout = pageview.get(position);
        container.addView(layout);
        return layout;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
         container.removeView((View)object);

    }

    @Override
    public boolean isViewFromObject(View arg0, Object arg1) {
        return arg0 == arg1;

    }

    @Override
    public int getCount() {
        return pageview.size();
    }
    @Override
    public int getItemPosition(Object object) {
        return POSITION_NONE;
    }

}
